package top.lixunda.commerce.common.core.exception;

import lombok.extern.slf4j.Slf4j;

/**
 * @author LiXunda
 * @version time:2019/10/29 14:00
 * <p>
 * 微服务内部调用使用异常
 */
@SuppressWarnings({"WeakerAccess", "unused"})
@Slf4j
public class AppException extends RuntimeException {

    private Integer code;

    private String msg;

    public AppException() {
        this(null, "");
    }

    public AppException(Integer code) {
        this(code, "");
    }

    public AppException(String msg) {
        this(null, msg);
    }

    public AppException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "AppException{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
